package edu.yuhf.tts.cui;

import java.util.List;
import java.util.Scanner;

import edu.yuhf.tts.dao.ReturnDao;
import edu.yuhf.tts.domain.Order;

public class ReturnCUI {
	
		public void returnCui() {
			System.out.println("进入退票页面");
			System.out.println("您当前的订单有：");
			List<Order> list=new ReturnDao().queryreturn();
			list.forEach((order)->{
				System.out.println("Id:"+order.getId()+"  User_Id:"+order.getUser_id()+"  TrainId:"+order.getTrainId()+"  BuyDate:"+order.getBuyDate()
				+"  Ticket:"+order.getTicketNumber()+"  Fares:"+order.getToTalFares());
				System.out.println("--------------------------------------------------------------------------");
			});
			System.out.println("请输入你所需要取消订单的编号-Id");
			Scanner in=new Scanner(System.in);
			for(int i=0;i<5;i++) {
			int id0=in.nextInt();
			int rowNum=new ReturnDao().returnd(id0);
			
			if(rowNum>=1) {
				System.out.println("订单取消成功！");
				break;
			}else {
				System.out.println("订单未取消成功 请检查输入的 Id 是否正确！");
			}
			}
		}
}
